/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.dao;

import br.com.classes.Nivel;
import br.com.classes.Tipo;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Kauane
 */
public class TipoDao {

    Connection con = null;

    public TipoDao() {
        con = Conecta.getConnection();
    }

    public List<Tipo> ListarTipo() {

        List<Tipo> lista = new ArrayList<Tipo>();
        try {
            String sql = "Select * FROM tipo";
            PreparedStatement stmt = (PreparedStatement) con.prepareStatement(sql);
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {
                Tipo t = new Tipo();
                t.setTipo(rs.getString("tipo"));
                lista.add(t);
            }

            stmt.execute();

        } catch (SQLException ex) {
        }
        return lista;
    }
}
